#ifndef IDENTTRACKERORB_H
#define IDENTTRACKERORB_H

#include "identtracker.h"
#include <opencv2/features2d.hpp>

class IdentTrackerORB : public IdentTracker
{
public:
    IdentTrackerORB(float scaleFactor);
    void initialize(const cv::Mat& templateImg, const cv::Rect& roi = cv::Rect()) override; // 添加 ROI 参数
    void setPreviousRect(const cv::Rect2d& rect) { prevRect = rect; }
    void setSimilarityThreshold(double threshold) { similarityThreshold = threshold; }
private:
    cv::Rect2d detectAndMatch(const cv::Mat& frame ,float &Similarity) override;
    cv::Mat descriptorsTemplate;
    std::vector<cv::KeyPoint> keypointsTemplate;
    cv::Ptr<cv::ORB> orb;
    void computeTemplateDescriptors(const cv::Mat& templateImg); // 修改方法签名以接收 ROI

    cv::Rect2d prevRect;
    cv::Rect2d bestIdentifiedRect;
    double minDistance;
    double similarityThreshold;
};

#endif // IDENTTRACKERORB_H
